package com.sky.config;

import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
import com.wechat.pay.java.core.notification.NotificationConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description TODO
 * @Author bo.li
 * @Date 2024/10/17 15:52
 * @Version 1.0
 */
@Configuration
public class WxConfig {

    @Value("${wechat.privateKey}")
    private String privateKey;

    @Bean
    public Config config(){
        Config config = new RSAAutoCertificateConfig.Builder()
                .merchantId("1561414331")
                .privateKey(privateKey)
                .merchantSerialNumber("4B3B3DC35414AD50B1B755BAF8DE9CC7CF407606")
                .apiV3Key("CZBK51236435wxpay435434323FFDuv3")
                .build();
        return config;
    }

    @Bean
    public NotificationConfig notificationConfig(){
        NotificationConfig config = new RSAAutoCertificateConfig.Builder()
                .merchantId("1561414331")
                .privateKey(privateKey)
                .merchantSerialNumber("4B3B3DC35414AD50B1B755BAF8DE9CC7CF407606")
                .apiV3Key("CZBK51236435wxpay435434323FFDuv3")
                .build();
        return config;
    }
}